Skip to content

Conversation

lmesnik
Copy link
Member

@lmesnik lmesnik commented Sep 5, 2025

This is the second attempt to fix method post_meth_exit to correctly set state and preserve result.
The related fix here:
b7b64bb
Hope fix became clarere now.

There 2 problems in this post_meth_exit:

  1. The result is preserved only if state->is_enabled(JVMTI_EVENT_METHOD_EXIT) however transition in the JRT_BLOCK_END happens always. So there is a risk of loosing method results in the interp_only mode.
  2. The method get_jvmti_thread_state should be called when thread is in vm state only.

The fix adds post_method_exit_transition to have single exit point with oop restoration.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8365192: post_meth_exit should be in vm state when calling get_jvmti_thread_state (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27112/head:pull/27112
$ git checkout pull/27112

Update a local copy of the PR:
$ git checkout pull/27112
$ git pull https://git.openjdk.org/jdk.git pull/27112/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27112

View PR using the GUI difftool:
$ git pr show -t 27112

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27112.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 5, 2025

👋 Welcome back lmesnik! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Sep 5, 2025

@lmesnik This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8365192: post_meth_exit should be in vm state when calling get_jvmti_thread_state

Reviewed-by: mdoerr, dholmes

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 52 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Sep 5, 2025

@lmesnik The following labels will be automatically applied to this pull request:

  • hotspot
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@mlbridge
Copy link

mlbridge bot commented Sep 5, 2025

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've taken a first pass through and the code reorg seems okay. It would have been a little clearer without factoring out the transition method.

Thanks

// At this point we only have the address of a "raw result" and
// we just call into the interpreter to convert this into a jvalue.
// The post_method_exit_transition always makes transition to vm and back
// where GC can happen. So it is needed to preserve result and then restore it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// where GC can happen. So it is needed to preserve result and then restore it
// where GC can happen. So it is needed to preserve result and then restore it

}
BasicType type = current_frame.interpreter_frame_result(&oop_result, &value);
assert(type == T_VOID || current_frame.interpreter_frame_expression_stack_size() > 0,
"Stack shouldn't be empty");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this assertion needs an adaptation. The expression stack can be empty for native method calls. The result does not necessarily need to be on the expression stack depending on the platform.
Or what else is the reason it is expected to be non-empty?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the native check! Looks good to me, now.

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks that looks clearer to me now.

One pre-existing typo.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 9, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Sep 9, 2025
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot [email protected] ready Pull request is ready to be integrated rfr Pull request is ready for review serviceability [email protected]
Development

Successfully merging this pull request may close these issues.

3 participants